/*
 * Copyright (c) 2009. Silenus Consultoria, S.L.
 */
package es.silenus.detecta.model;

/**
 * Imported file status.
 *
 * @author <a href="mailto:malonso@silenus-consultoria.es">Mariano Alonso</a>
 * @since 30-jun-2009 13:28:33
 */
public enum ImportedFileStatus implements IntegerEnumeration {
/**
   * The file has been uploaded but not yet validated.
   */
	UPLOADED(1, "file.status.uploaded"), 
/**
   * The file has been validated.
   */
	VALIDATED(2, "file.status.validated"), 
/**
   * The file has been discarded.
   */
	DISCARDED(3, "file.status.discarded"), 
/**
   * The file has been imported.
   */
	IMPORTED(4, "file.status.imported");
	/**
	 * The id.
	 */
	private final int id;

	/**
	 * The key.
	 */
	private final String key;

/**
   * Constructor.
   *
   * @param id  the id.
   * @param key the key.
   */
	ImportedFileStatus(int id, String key) {
		this.id = id;
		this.key = key;
	}

	/**
	 * Retrieves the identifier.
	 *
	 * @return the identifier.
	 */
	public int getId() {
		return id;
	}

	/**
	 * Retrieves the key.
	 *
	 * @return the key.
	 */
	public String getKey() {
		return key;
	}

	/**
	 * Retrieves a value by its identifier.
	 *
	 * @param id the id.
	 *
	 * @return the origin.
	 */
	public static ImportedFileStatus getById(int id) {
		switch(id) {
			case 1:
				return UPLOADED;

			case 2:
				return VALIDATED;

			case 3:
				return DISCARDED;

			case 4:
				return IMPORTED;
		}

		return null;
	}
}
